package com.thesis.controller;

import com.thesis.common.CommonEnum;
import com.thesis.common.MD5Util;
import com.thesis.common.ResponseBean;
import com.thesis.entity.Record;
import com.thesis.entity.SysAdmin;
import com.thesis.service.AdminService;
import com.thesis.service.RecordService;
import com.thesis.utils.ResultVo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.util.List;

/**
 * Created by Anvy at 2020/4/19.
 */
@Controller
@RequestMapping("/wx/record")
public class RecordHandler {

    private static  final Logger log= LoggerFactory.getLogger(RecordHandler.class);

    @Autowired
    private RecordService recordService;

    @PostMapping("list")
    @ResponseBody
    public ResponseBean list(){
        List<Record> records = recordService.findAll();
        return new ResponseBean(true,records,CommonEnum.SUCCESS_OPTION);
    }

    @PostMapping("add")
    @ResponseBody
    public ResponseBean add(@RequestBody Record record){
        recordService.insert(record);
        return new ResponseBean(true,null, CommonEnum.SUCCESS_OPTION);
    }

}
